import {captchaService} from 'WE/Services';
import QRCodeScanner from 'react-native-qrcode-scanner';

const OTP_NAME = 'otpauth://';
export default function ScannerScreen({navigation}) {
  const onSuccess = ({data}) => {
    if (data.startsWith(OTP_NAME)) {
      captchaService.addCaptchaData(data);
    }
    navigation.goBack();
  };

  return <QRCodeScanner onRead={onSuccess} />;
}
